package com.controlstudent.android.app.util;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Programador
 */
public class URLUtil {

    public static String getContent(String url) {
        InputStream is = null;
        try {
            is = (InputStream) new URL(url).getContent();
            BufferedReader br = new BufferedReader(new InputStreamReader(is));
            String xml = "";
            String line = br.readLine();
            while (line != null) {
                xml += line;
                line = br.readLine();
            }
            return xml;
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            try {
                is.close();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }
        return "";
    }
}
